package cn.dubito.initalizrstart.controller;

import cn.dubito.initalizrstart.repository.UserRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.servlet.ModelAndView;

/**
 * @author liliang
 * @description:
 * @date 2018/6/16.
 */
@RestController
@RequestMapping("/user")
public class UserController {

    @Autowired
    private UserRepository userRepository;

    public ModelAndView list(Model model) {
        model.addAttribute("userList", userRepository.getUserList());
        model.addAttribute("title", "用户管理");
        return new ModelAndView("user/list", "userModel", model);
    }
}
